
***Competitive Elections, Status Anxieties, and the Relative Strength of Ethnic versus National Identification in Africa***


//Results in the Main Text

***Table 3: Competitive Elections and National Identification***

//Model 1:

xtmelogit nat_only i.comp_scale proximity i.comp_scale#c.proximity i.round trend pweight coethnic_int alone honest ||country:

//Model 2:

xtmelogit nat_only i.comp_scale proximity i.comp_scale#c.proximity pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight ||country:

//Model 3:

g national = -1*ethnic
meologit national i.comp_scale proximity i.comp_scale#c.proximity i.round trend pweight coethnic_int alone honest if round!=2 ||country: //Ethnic id. scale available from Afrobarometer Round 3+ only. 

//Model 4:

xtset country
xtreg national i.comp_scale proximity i.comp_scale#c.proximity coethnic_int alone honest i.round trend pweight if round !=2, re 

***Figure 1: Competitive Elections and National versus Ethnic Identification***

//NB: All figures can also be reproduced using fixed effects logit and OLS.

//Left panel: national identity only

xtmelogit nat_only i.comp_scale proximity i.comp_scale#c.proximity  pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight ||country:
margins (comp_scale), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict(mu fixed)
marginsplot, scheme(sj)

//Middle panel: national and ethnic equal

xtmelogit ethn_nat i.comp_scale proximity i.comp_scale#c.proximity  pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight ||country:
margins (comp_scale), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict(mu fixed)
marginsplot, scheme(sj)

//Right panel: ethnic identity only 

xtmelogit ethnic_only i.comp_scale proximity i.comp_scale#c.proximity  pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight ||country:
margins (comp_scale), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict(mu fixed)
marginsplot, scheme(sj)

***Table 4: Attitudes and Perceptions Accompanying Strong Ethnic Attachments in Africa***

//Model 1:

xtmelogit ethnic_only benefit unfair trend pweight i.round ||country: 
margins, dydx(benefit unfair) predict(mu fixed)

//Model 2: 
 
xtmelogit ethnic_only benefit unfair pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest trend pweight i.round ||country: 
margins, dydx(benefit unfair) predict(mu fixed)

//Model 3:

xtmelogit ethnic_only benefit jobs development pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest pweight ||country: 
margins, dydx(benefit jobs development) predict(mu fixed)

//Model 4:

xtmelogit ethnic_only unfair econ_anx pol_anx ethn_trust pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest pweight ||country: 
margins, dydx(unfair econ_anx pol_anx ethn_trust) predict(mu fixed)

//Model 5:

xtmelogit ethnic_only benefit jobs development unfair econ_anx pol_anx ethn_trust pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest pweight ||country: 
margins, dydx(benefit jobs development unfair econ_anx pol_anx ethn_trust) predict(mu fixed)

***Table 5: Competitive Elections and Perceived Discrimination***

//Model 1:

xtmelogit unfair i.comp_scale proximity i.comp_scale#c.proximity coethnic_int alone honest i.round trend pweight ||country:
margins, dydx (proximity comp_scale) predict (mu fixed)
margins, dydx (proximity) at (comp_scale = (0, 1, 2)) predict(mu fixed)

//Model 2:

xtmelogit unfair i.comp_scale proximity i.comp_scale#c.proximity rural female employed education age age_sq media_exposure trust_rp coethnic_int alone honest i.round trend pweight ||country:
margins, dydx (proximity comp_scale) predict (mu fixed)
margins, dydx (proximity) at (comp_scale = (0, 1, 2)) predict(mu fixed)

//Model 3:

mlogit unfair i.comp_scale proximity i.comp_scale#c.proximity rural female employed education age age_sq media_exposure trust_rp coethnic_int alone honest i.round trend pweight i.country, base(0)
margins, dydx (proximity comp_scale) predict (mu fixed)
margins, dydx (proximity) at (comp_scale = (0, 1, 2)) predict(mu fixed)

//Model 4:

xtset country
xtreg unfair i.comp_scale proximity i.comp_scale#c.proximity i.round trend pweight coethnic_int alone honest, re 

***Figure 2: Competitive Elections and Perceived Discrimination***

xtmelogit unfair i.comp_scale proximity i.comp_scale#c.proximity rural female employed education age age_sq coethnic_int alone honest i.round trend pweight || country:
margins (comp_scale), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict(mu fixed)
marginsplot, scheme(sj) 

***Figure 3: Competitive Elections and Relative Status Anxieties***

//Left panel: economic conditions worse or much worse

 xtmelogit high_econanx i.comp_scale proximity i.comp_scale#c.proximity  pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight ||country:
 margins (comp_scale), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict(mu fixed)
 marginsplot, scheme(sj) 
 
//Right panel: political influence worse or much worse 

 xtmelogit high_polanx i.comp_scale proximity i.comp_scale#c.proximity  pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight ||country:
 margins (comp_scale), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict(mu fixed)
 marginsplot, scheme(sj) 

***Figure 4: Competitive Elections and Ethnic and Generalized Trust***

//Left Panel:

xtmelogit no_trust i.comp_scale proximity i.comp_scale#c.proximity coethnic_int alone honest ||country:
margins (comp_scale), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict(mu fixed)
marginsplot, scheme(sj) 
 
 //Right Panel:
 
 xtmelogit generalized_trust i.comp_scale proximity i.comp_scale#c.proximity coethnic_int alone honest i.round trend pweight ||  country:
 margins (comp_scale), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict(mu fixed)
 marginsplot, scheme(sj) 

***Figure 5: Perceived Discrimination by Competitiveness and Ethnic Group Size***

//Left Panel
xtmelogit unfair proximity i.pl_group i.pl_group#c.proximity coethnic_int alone honest i.round trend pweight ||country: if comp_scale == 0
margins (pl_group), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict(mu fixed)
marginsplot, scheme(sj) 

//Middle Panel
xtmelogit unfair proximity i.pl_group i.pl_group#c.proximity coethnic_int alone honest i.round trend pweight ||country: if comp_scale == 1
margins (pl_group), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict(mu fixed)
marginsplot, scheme(sj) 

//Right Panel
xtmelogit unfair proximity i.pl_group i.pl_group#c.proximity coethnic_int alone honest i.round trend pweight ||country: if comp_scale == 2
margins (pl_group), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict(mu fixed)
marginsplot, scheme(sj) 


***Figure 6: Perceived Discrimination by Competitiveness and Rally Attendance***

//Left Panel
xtmelogit unfair proximity i.rally i.rally#c.proximity coethnic_int alone honest i.round trend pweight ||country: if comp_scale == 0
margins (rally), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict(mu fixed)
marginsplot, scheme(sj) 

//Middle Panel
xtmelogit unfair proximity i.rally i.rally#c.proximity coethnic_int alone honest i.round trend pweight ||country: if comp_scale == 1
margins (rally), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict(mu fixed)
marginsplot, scheme(sj) 

//Right Panel
xtmelogit unfair proximity i.rally i.rally#c.proximity coethnic_int alone honest i.round trend pweight ||country: if comp_scale == 2
margins (rally), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict(mu fixed)
marginsplot, scheme(sj) 

***Figure 7: Competitive Elections and Support for Co-ethnic Favoritism***

xtmelogit ben_dummy i.comp_scale proximity i.comp_scale#c.proximity  pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight ||country:
margins (comp_scale), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict(mu fixed)
marginsplot, scheme(sj) 

//NB: All figures can also be reproduced using fixed effects logit and OLS.

///////////////////////////////
***Results in the Appendix***
//////////////////////////////

***Table 1: Additional Specifications for Table 3 in Main Text***

//Model 2: Country Fixed Effects

logit nat_only i.comp_scale proximity i.comp_scale#c.proximity i.round trend pweight coethnic_int alone honest i.country

//Model 2: Country Fixed Effects and Additional Controls

logit nat_only i.comp_scale proximity i.comp_scale#c.proximity pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight i.country

//Model 2: Linear Competitiveness Measure

xtmelogit nat_only compet proximity c.compet#c.proximity i.round trend pweight coethnic_int alone honest ||country:

//Model 2: Linear Competitiveness Measure, Country Fixed Effects

logit nat_only compet proximity c.compet#c.proximity i.round trend pweight coethnic_int alone honest i.country

//Model 3: Multinomial Logit, Country Fixed Effects

mlogit national i.comp_scale proximity i.comp_scale#c.proximity i.round trend pweight coethnic_int alone honest i.country

//Model 4: OLS, Country Fixed Effects 

xtset country
xtreg nat_only i.comp_scale proximity i.comp_scale#c.proximity pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight, fe


***Table 2: Additional Specifictions for Table 4 in Main Text***

//OLS, Country Fixed Effects, Ethnic id. scale

xtset country
xtreg ethnic benefit jobs development unfair econ_anx pol_anx ethn_trust pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest pweight, fe

***Table 3: Additional Specifications for Table 5 in Main Text***

//Linear Competitiveness Measure

xtmelogit nat_only compet proximity c.compet#c.proximity i.round trend pweight coethnic_int alone honest ||country:


//Multinomial Probit, Country Fixed Effects

mprobit unfair i.comp_scale proximity i.comp_scale#c.proximity rural female employed education age age_sq media_exposure trust_rp coethnic_int alone honest i.round trend pweight i.country, base(0)

//OLS, Country Fixed Effects, Individual Covariates

xtset country
xtreg unfair i.comp_scale proximity i.comp_scale#c.proximity rural female employed education age age_sq media_exposure trust_rp coethnic_int alone honest i.round trend pweight, fe

//OLS, Linear Competitiveness Measure, Country Fixed Effects 

xtreg unfair compet proximity c.compet#c.proximity coethnic_int alone honest i.round trend pweight, fe

***Figure 5: Electoral Competitiveness and Perceived Discrimination: Alternative Competitiveness Cut-off***

xtmelogit unfair i.scale proximity i.scale#c.proximity coethnic_int alone honest i.round trend pweight ||country:
margins (scale), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict (mu fixed)
marginsplot, scheme(sj) noci

***Figure 6: Electoral Competitiveness and Perceived Discrimination: Survey Taken Before and after the Elections*** 

//Left Panel:
xtmelogit unfair i.comp_scale proximity i.comp_scale#c.proximity coethnic_int alone honest i.round trend pweight ||country: if approaching == 1
margins (scale), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict (mu fixed)
marginsplot, scheme(sj) noci

//Right Panel:
xtmelogit unfair i.comp_scale months i.comp_scale#c.months coethnic_int alone honest i.round trend pweight ||country: if approaching == 0
margins (scale), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict (mu fixed)
marginsplot, scheme(sj) noci

***Table 4: Results for Figure 3, panel 1 (left)***

//Model 1:

xtmelogit high_econanx i.comp_scale proximity i.comp_scale#c.proximity  pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight ||country:

//Model 2:

ologit econ_anx i.comp_scale proximity i.comp_scale#c.proximity  pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight i.country

//Model 3: 

xtreg econ_anx i.comp_scale proximity i.comp_scale#c.proximity  pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight, fe

***Table 5: National Identification: Controlling for Electoral Contention***

//Model 1:
xtmelogit nat_only i.comp_scale proximity i.comp_scale#c.proximity ecav_violent i.round trend pweight ||country:

//Model 2:
xtmelogit nat_only i.comp_scale proximity i.comp_scale#c.proximity ecav_violent pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight ||country:

//Model 3:

logit nat_only i.comp_scale proximity i.comp_scale#c.proximity ecav pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight i.country

//Model 4: 

xtset country
xtreg nat_only i.comp_scale proximity i.comp_scale#c.proximity ecav pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight, fe

***Table 6: Perceived Discrimination: Controlling for Electoral Contention***

//Model 1:

xtmelogit unfair i.comp_scale proximity i.comp_scale#c.proximity ecav i.round trend pweight ||country:

//Model 2:

xtmelogit unfair i.comp_scale proximity i.comp_scale#c.proximity ecav pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight ||country:

//Model 3:

logit unfair i.comp_scale proximity i.comp_scale#c.proximity ecav pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight i.country

//Model 4: 

xtset country
xtreg unfair i.comp_scale proximity i.comp_scale#c.proximity ecav pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest i.round trend pweight, fe

***Figure 9: Perceived Discrimination by Level of Interest in Public Affairs***

//Left Panel:

xtmelogit unfair i.public_interest proximity i.public_interest#c.proximity coethnic_int alone honest i.round trend pweight ||country: if comp_scale == 0
margins (public_interest), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict (mu fixed)
marginsplot, scheme(sj) noci

//Middle Panel:

xtmelogit unfair i.public_interest proximity i.public_interest#c.proximity coethnic_int alone honest i.round trend pweight ||country: if comp_scale == 1
margins (public_interest), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict (mu fixed)
marginsplot, scheme(sj) noci

//Right Panel:

xtmelogit unfair i.public_interest proximity i.public_interest#c.proximity coethnic_int alone honest i.round trend pweight ||country: if comp_scale == 2
margins (public_interest), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict (mu fixed)
marginsplot, scheme(sj) noci

***Figure 10: Perceived Discrimination by Ethnic Group in Power***

//Left Panel:

xtmelogit unfair proximity i.power i.power#c.proximity coethnic_int alone honest i.round trend pweight ||country: if comp_scale == 0
margins (power), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict (mu fixed)
marginsplot, scheme(sj) noci

//Middle Panel:

xtmelogit unfair proximity i.power i.power#c.proximity coethnic_int alone honest i.round trend pweight ||country: if comp_scale == 1
margins (power), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict (mu fixed)
marginsplot, scheme(sj) noci

//Right Panel:

xtmelogit unfair proximity i.power i.power#c.proximity coethnic_int alone honest i.round trend pweight ||country: if comp_scale == 2
margins (power), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict (mu fixed)
marginsplot, scheme(sj) noci

***Figure 11: Coethnic Favoritism by Incumbent Party Support***

//Left Panel:

logit ben_dummy proximity i.support_rp i.support_rp#c.proximity coethnic_int alone honest i.round trend pweight i.country if comp_scale == 0
margins (support_rp), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict (mu fixed)
marginsplot, scheme(sj) noci

//Middle Panel:
logit ben_dummy proximity i.support_rp i.support_rp#c.proximity coethnic_int alone honest i.round trend pweight i.country if comp_scale == 1
margins (support_rp), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict (mu fixed)
marginsplot, scheme(sj) noci

//Right Panel:
logit ben_dummy proximity i.support_rp i.support_rp#c.proximity coethnic_int alone honest i.round trend pweight i.country if comp_scale == 2
margins (support_rp), at (proximity = (-35, -30, -25, -20, -15, -10, -5, 0)) predict (mu fixed)
marginsplot, scheme(sj) noci

***Table 13: Attitudes and Perceptions Accompanying Strong Ethnic Attachments (respondents admitting to paying bribes only***

//Model 2: 
 
xtmelogit ethnic_only benefit unfair pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest trend pweight i.round ||country: if paid_bribe == 1

//Model 3:

xtmelogit ethnic_only benefit jobs development pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest pweight ||country: if paid_bribe == 1

//Model 4:

xtmelogit ethnic_only unfair econ_anx pol_anx ethn_trust pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest pweight ||country: if paid_bribe == 1

//Model 5:

xtmelogit ethnic_only benefit jobs development unfair econ_anx pol_anx ethn_trust pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp coethnic_int alone honest pweight ||country:if paid_bribe == 1

***Table 14: Attitudes and Perceptions Accompanying Strong Ethnic Attachments (respondents interviewed by coethnics only***

//Model 2: 
 
xtmelogit ethnic_only benefit unfair pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp alone honest trend pweight i.round ||country: if coethnic_int == 1

//Model 3:

xtmelogit ethnic_only benefit jobs development pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp alone honest pweight ||country: if coethnic_int == 1

//Model 4:

xtmelogit ethnic_only unfair econ_anx pol_anx ethn_trust pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp alone honest pweight ||country: if coethnic_int == 1

//Model 5:

xtmelogit ethnic_only benefit jobs development unfair econ_anx pol_anx ethn_trust pl_group power rural female employed education age age_sq media_exposure public_interest trust_rp alone honest pweight ||country: if coethnic_int == 1
